import { get, post } from '@/api/my_axios'
import router from '../../../router'
import 'element-ui/lib/theme-chalk/index.css'
import { Loading } from 'element-ui'

const module1 = {
  state: {
    menu_list: [],
    UserInfo: {},
    dial_type: [],
    style_type: [],
    res_type: [],
    devType: [],
    dev: [],
    adaptDevice: [],
    dialList: [],
    series: [],
    dialSmallTags: [],
    dialKeyWords: [],
    diamondDistrictList: [],
    diamondDistrictMappingList: [],
    dialCollectionList: [],
    dialCollectionMappingList: [],
    company: [],
    api: [],
    is_show_button: [],
    dialId: '',
    countryList: [],
    strListData: [],
    appInformationList: [],
    appQuestionsList: [],
    adaptList: [],
    dialListData: [],
    dialInfo: {},
    sysDictItemList: [],
    appInfoList: [],
    appNameMap: new Map(),
    cUserInfoList: [],
    cUserDetailsInfo: {},
    appAdvertList: [],
    appAdvertResList: [],
    dialMemberList: [],
    exchangeEquityList: [],
    exchangeCodeList: [],
    appRenewList: [],
    appRenewChannel: [],
    icMcodeCascadeRelationList: [],
    deviceVersionList: [],
    worldCityList: [],
    chinaCityCascadeList: [],
    wallpaperCollectionList: [],
    wallpaperKeyWordsList: [],
    wallpaperTagList: [],
    AppFunctionsList: [],
    // 客需
    total: 1,
    adaptTotal: 1,
    appAdvertTotal: 1,
    advertResourcesTotal: 1,
    exchangeEquityTotal: 1,
    exchangeCodeTotal: 1,
    appRenewTotal: 1,
    appRenewChannelTotal: 1,
    devListTotal: 1,
    dialSmallTagTotal: 1,
    dialKeyWordsTotal: 1,
    diamondDistrictTotal: 1,
    wallpaperCollectionTotal: 1,
    wallpaperKeyWordsTotal: 1,
    wallpaperTagTotal: 1,
    appFunctionsTotal: 1
  },
  mutations: {
    // 获取菜单管理
    get_munt_list(state, url) {
      const loading = Loading.service({
        lock: false,
        spinner: '',
        background: 'rgba(0,0,0,0.7)',
      });

      state.menu_list = [];

      // 定义登录地址列表
      const loginPaths = [
        '/web/cmsview/crm/Login', // 自己公司用的登录地址
        '/customer/web/Login', // 客户用的登录地址
        '/',
      ];

      setTimeout(() => {
        loading.close();
      }, 1000);

      post(url).then((req) => {
        setTimeout(() => {
          loading.close();
        }, 1000);

        if (req && req.code === 200) {
          req.data.forEach((v) => {
            if (v.path && v.menuType.includes('M')) {
              state.menu_list.push({
                path: v.path,
                name: v.path,
                component: () =>
                  v.path.split('/').length > 0
                    ? import(`../../../views${v.path}.vue`)
                    : '',
              });
            }
          });

          // 根据当前路径决定是客户登录还是公司登录
          const currentPath = window.location.pathname;

          // 如果当前路径是客户登录路径，跳转到客户首页
          if (currentPath === '/customer/web/Login') {
            this.getUserData();
            setTimeout(() => {
              router.replace({ path: '/customer/web/Home' });
            }, 500);
          }
          // 如果当前路径是公司登录路径，跳转到公司首页
          else if (currentPath === '/web/cmsview/crm/Login') {
            this.getUserData();
            setTimeout(() => {
              router.replace({ path: '/web/cmsview/crm/Home' });
            }, 500);
          }
        }
      });
    },

    // 获取用户详情
    getUserData (state, res) {
      // post('/api/crm/sys/manage/crm/user/getUserInfo').then(req => {
      //   if (req && req.code === 200) { state.UserInfo = req.data.user }
      // })
        state.UserInfo = res.data.user
    },
    // 表盘类型
    getDialType (state, params) {
      state.dial_type = []
      post('/web/cms/dial/0.2/dial/type/list', { queryParam: '', status: '' }).then(req => {
        if (req && req.code === 200) { state.dial_type = req.data }
      })
    },
    // 表盘显示风格管理
    getStyleType (state, params) {
      state.style_type = []
      post('/web/cms/dial/0.2/dial/style/list', { queryParam: '', status: '' }).then(req => {
        if (req && req.code === 200) { state.style_type = req.data }
      })
    },
    // 表盘资源文件类型管理
    getResType (state, params) {
      state.res_type = []
      post('/web/cms/dial/0.2/dial/res/list', { queryParam: '', status: '' }).then(req => {
        if (req && req.code === 200) { state.res_type = req.data }
      })
    },
    // 设备型号
    getdevType (state, params) {
      state.devType = []
      post('/web/cms/dial/0.2/dev/type/list', params || { queryParam: '', status: '' }).then(req => {
        if (req && req.code === 200) {
          state.devType = req.data
          params && params.pageNum && (state.total = req.total)
          if (params && params.pageNum != 1 && req.data.length < 1) {
            params.pageNum = params.pageNum - 1
            this.dispatch('getdevTypeList', params)
          }
        }
      })
    },
    // 设备管理
    getdev (state, params) {
      state.dev = []
      post('/web/cms/dial/0.2/dev/list', params).then(req => {
        if (req && req.code === 200) {
          state.dev = req.data
          params && params.pageNum && (state.devListTotal = req.total)
          if (params && params.pageNum != 1 && req.data.length < 1) {
            params.pageNum = params.pageNum - 1
            this.dispatch('getdevList', params)
          }
        }
      })
    },

    // 设备适配管理
    getAdaptDevice (state, params) {
      state.adaptDevice = []
      post('/web/cms/dial/0.2/dev/queryDialDevList', params).then(req => {
        if (req && req.code === 200) {
          state.adaptDevice = req.data
          params && params.pageNum && (state.total = req.total)
        }
      })
    },

    // 表盘
    getDialList (state, params) {
      state.dialList = []
      post('/api/cms/sysuser/auth/0.2/dial/mgr/queryDialList', params).then(req => {
        if (req && req.code === 200) {
          state.dialList = req.data
        }
      })
    },
    // 表盘系列
    getSeries (state, params) {
      state.series = []
      post('/web/cms/dial/0.2/dial/series/list', params || { queryParam: '', status: '' }).then(req => {
        if (req && req.code === 200) {
          state.series = req.data
          params && params.pageNum && (state.total = req.total)
          if (params && params.pageNum != 1 && req.data.length < 1) {
            params.pageNum = params.pageNum - 1
            this.dispatch('getSeriesList', params)
          }
        }
      })
    },

    // 表盘市场Tag
    getDialSmallTagList (state, res) {
      state.dialSmallTags = res.data
      state.dialSmallTagTotal = res.total
    },

    // 表盘关键字
    getDialKeyWordsList (state, res) {
       state.dialKeyWords = res.data
       state.dialKeyWordsTotal = res.total
    },

    // 表盘市场金刚区
    getDialDiamondDistrictList (state, res) {
      state.diamondDistrictList = res.data
      state.diamondDistrictTotal = res.total
      // state.diamondDistrictList = []
      // post('/api/cms/sysuser/auth/dialMarket/kongDistrict/queryKongDistrictList', params || { queryParam: '', status: '' }).then(req => {
      //   if (req && req.code === 200) {
      //     state.diamondDistrictList = req.data
      //     params && params.pageNum && (state.total = req.total)
      //     if (params && params.pageNum !== 1 && req.data.length < 1) {
      //       params.pageNum = params.pageNum - 1
      //       this.dispatch('getDialDiamondDistrictList', params)
      //     }
      //   }
      // })
    },
    // 表盘市场金刚区合集映射
    getDiamondDistrictMappingList (state, params) {
      state.diamondDistrictMappingList = []
      post('/api/cms/sysuser/auth/dialMarket/kongDistrict/queryKongDistrictMappingList', params || { collectionCode: '', searchValue: '', dialId: '' }).then(req => {
        if (req && req.code === 200) {
          state.diamondDistrictMappingList = req.data
          params && params.pageNum && (state.total = req.total)
        }
      })
    },

    // 表盘合集
    getDialCollectionList (state, params) {
      state.dialCollectionList = []
      post('/api/cms/sysuser/auth/dialMarket/collection/queryDialCollectionList', params || { code: '', queryParam: '', status: '' }).then(req => {
        if (req && req.code === 200) {
          state.dialCollectionList = req.data
          params && params.pageNum && (state.total = req.total)
        }
      })
    },
    // 表盘合集映射
    getDialCollectionMappingList (state, params) {
      state.dialCollectionMappingList = []
      // this.total = state.total
      post('/api/cms/sysuser/auth/dialMarket/collection/queryDialCollectionMapperList', params || {}).then(req => {
        if (req && req.code === 200) {
          state.dialCollectionMappingList = req.data
          state.total = req.total
        }
      })
    },
    // 企业列表
    getcompany (state, params) {
      state.company = []
      post('/api/cms/sysuser/auth/0.2/company/list', params).then(req => {
        if (req && req.code === 200) {
          state.company = req.data
          params && params.pageNum && (state.total = req.total)
          if (params && params.pageNum != 1 && req.data.length < 1) {
            params.pageNum = params.pageNum - 1
            this.dispatch('getcompanyList', params)
          }
        }
      })
    },

    // 保存表盘id
    getDialIds (state, id) {
      state.dialId = id
    },

    // 保存国家列表
    getCountryList (state, params) {
      post('/api/cms/sysuser/auth/0.4/country/list', params).then(req => {
        if (req && req.code === 200) {
          state.countryList = req.data
          params && params.pageNum && (state.total = req.total)
          if (params && params.pageNum !== 1 && req.data.length < 1) {
            params.pageNum = params.pageNum - 1
            this.dispatch('get_country_list', params)
          }
        }
      })
    },

    // 保存国际化字符串
    getStrList (state, params) {
      post('/api/cms/sysuser/auth/0.4/in/str/list', params).then(req => {
        if (req && req.code === 200) {
          state.strListData = req.data
        }
      })
    },

    // app列表信息
    getAppInformationList (state, params) {
      post('/api/cms/sysuser/auth/systemApp/information/queryAppInfoAllList', params).then(req => {
        if (req && req.code === 200) {
          state.appInformationList = req.data
          state.total = req.total
        }
      })
    },

    // app常见问题列表
    getAppQuestionsList (state, params) {
      post('/api/cms/sysuser/auth/question/configuration/getAllQuestionList', params).then(req => {
        if (req && req.code === 200) {
          state.appQuestionsList = req.data
          state.total = req.total
        }
      })
    },

    // 获取适配列表
    getAdaptList (state, params) {
      post('/web/cms/dial/0.2/dial/mgr/adaptList', params).then(req => {
        if (req && req.code === 200) {
          state.adaptList = req.data
          state.adaptTotal = req.total
        }
      })
    },

    // 获取表盘列表
    getDialListData (state, data) {
      state.dialListData = data
    },
    // 获取表盘详情
    getDialInfo (state, params) {
      post('/web/cms/dial/0.2/dial/mgr/getDialInfo', params).then(req => {
        if (req && req.code === 200) {
          state.dialInfo = req.data
          return req.data
        }
      })
    },

    // 获取字典项数据
    getSysDictItemList (state, params) {
      state.sysDictItemList = params
    },

    // app名字Map
    getAppNameMap (state, data) {
      state.appNameMap = new Map(Object.entries(data))
    },

    // app信息列表
    getAppInfoList (state, data) {
      state.appInfoList = data
    },

    // C端用户信息列表
    getCUserInfoList (state, params) {
      post('/api/cms/sysuser/auth/user/manage/queryUserInfoList', params || {}).then(req => {
        if (req && req.code === 200) {
          state.cUserInfoList = req.data
          state.total = req.total
        }
      })
    },

    // C端用户信息详情
    getUserDetailsInfo (state, params) {
      post('/api/cms/sysuser/auth/user/manage/getUserDetailsInfo', params || {}).then(req => {
        if (req && req.code === 200) {
          state.cUserDetailsInfo = req.data
        }
      })
    },

    // 广告列表
    getAppAdvertList (state, params) {
      post('/api/cms/sysuser/auth/0.4/web/appAdvert/queryAppAdvertList', params || {}).then(req => {
        if (req && req.code === 200) {
          state.appAdvertList = req.data
          state.appAdvertTotal = req.total
        }
      })
    },

    // 广告资源列表
    getAppAdvertResList (state, params) {
      post('/api/cms/sysuser/auth/appAdvertRes/queryAppAdvertResList', params || {}).then(req => {
        if (req && req.code === 200) {
          state.appAdvertResList = req.data
          state.advertResourcesTotal = req.total
        }
      })
    },

    // 表盘会员配置列表
    getDialMemberList (state, params) {
      post('/api/cms/sysuser/auth/dial/member/getDialMemberList', params || {}).then(req => {
        if (req && req.code === 200) {
          state.dialMemberList = req.data
        }
      })
    },

    // 兑换权益配置列表
    getExchangeEquityList (state, params) {
      post('/api/cms/sysuser/auth/exchange/queryEquityList', params || {}).then(req => {
        if (req && req.code === 200) {
          state.exchangeEquityList = req.data
          state.exchangeEquityTotal = req.total
        }
      })
    },

    // 兑换码列表
    getExchangeCodeList (state, params) {
      post('/api/cms/sysuser/auth/exchange/queryExchangeCodeList', params || {}).then(req => {
        if (req && req.code === 200) {
          state.exchangeCodeList = req.data
          state.exchangeCodeTotal = req.total
        }
      })
    },

    // 获取app版本升级信息列表
    getAppRenewList(state, req) {
      state.appRenewList = req.data
      state.appRenewTotal = req.total
    },
    // 获取app更新应用平台列表
    getAppRenewChannelList(state, req) {
      state.appRenewChannelList = req.data
      state.appRenewChannelTotal = req.total
    },

    // 获取app更新应用平台列表
    getIcMcodeCascadeRelation(state, data) {
      state.icMcodeCascadeRelationList = data
    },

    // 设备版本配置信息列表
    getDeviceVersionList(state, data) {
      state.deviceVersionList = data
    },

    // 中国省/市级联关系列表
    getChinaCascadeRelation(state, res) {
      state.chinaCityCascadeList = res.data
    },

    // 获取世界城市列表
    getWorldCityList(state, res) {
      state.worldCityList = res.data
    },

    // 壁纸管理-合集
    getWallpaperCollectionList (state, res) {
      state.wallpaperCollectionList = res.data
      state.wallpaperCollectionTotal = res.total
    },

    // 壁纸管理-关键字
    getWallpaperKeyWordsList (state, res) {
      state.wallpaperKeyWordsList = res.data
      state.wallpaperKeyWordsTotal = res.total
    },

    // 壁纸管理-Tag
    getWallpaperTagList (state, res) {
      state.wallpaperTagList = res.data
      state.wallpaperTagTotal = res.total
    },

    // App相关管理-App功能配置
    getAppFunctionsList (state, res) {
      state.appFunctionsList = res.data
      state.appFunctionsTotal = res.total
    },

  },
  actions: {
    get_munt ({ commit }) { return commit('get_munt_list', '/api/crm/sys/manage/crm/function/getRouters') },
    // getUser ({ commit }) { return commit('getUserData') },
    getDialTypeList ({ commit }) { return commit('getDialType') },
    getStyleTypeList ({ commit }) { return commit('getStyleType') },
    getResTypeList ({ commit }, params) { return commit('getResType') },
    getdevTypeList ({ commit }, params) { return commit('getdevType', params) },
    getdevList ({ commit }, params) { return commit('getdev', params) },
    getAdaptDevice ({ commit }, params) { return commit('getAdaptDevice', params) },
    getDialListByDevId ({ commit }, params) { return commit('getDialList', params) },
    getSeriesList ({ commit }, params) { return commit('getSeries', params) },
    getDiamondDistrictMappingList ({ commit }, params) { return commit('getDiamondDistrictMappingList', params) },
    getDialCollectionList ({ commit }, params) { return commit('getDialCollectionList', params) },
    getDialCollectionMappingList ({ commit }, params) { return commit('getDialCollectionMappingList', params) },
    getcompanyList ({ commit }, params) { return commit('getcompany', params) },
    getDialId ({ commit }, id) { return commit('getDialIds', id) },
    get_country_list ({ commit }, params) { return commit('getCountryList', params) },
    get_str_list ({ commit }, params) { return commit('getStrList', params) },
    getAppInformationList ({ commit }, params) { return commit('getAppInformationList', params) },
    getAppQuestionsList ({ commit }, params) { return commit('getAppQuestionsList', params) },
    getAdaptList ({ commit }, params) { return commit('getAdaptList', params) },
    getUserDetailsInfo ({ commit }, params) { return commit('getUserDetailsInfo', params) },
    getAppAdvertList ({ commit }, params) { return commit('getAppAdvertList', params) },
    getAppAdvertResList ({ commit }, params) { return commit('getAppAdvertResList', params) },
    getDialMemberList ({ commit }, params) { return commit('getDialMemberList', params) },
    getExchangeEquityList ({ commit }, params) { return commit('getExchangeEquityList', params) },
    getExchangeCodeList ({ commit }, params) { return commit('getExchangeCodeList', params) },

    // 获取用户详情
    async getUserData ({ commit }, params) {
      let res = await post('/api/crm/sys/manage/crm/user/getUserInfo', params || {})
      if (res && res.code === 200) {
        commit('getUserData', res)
        return res
      }
      // post('/api/crm/sys/manage/crm/user/getUserInfo').then(req => {
      //   if (req && req.code === 200) { state.UserInfo = req.data.user }
      // })
    },

    // 其他全局-查看操作日志
    async getSysOperLog({ commit }, params) {
      let res = await post('/api/crm/sys/manage/management/queryOperLog', params || {})
      if (res && res.code === 200) {
        return res
      }
    },

    // 其他全局-获取全部菜单列表
    async getAllMenuList({ commit }, params) {
      let res = await post('/api/crm/sys/manage/crm/function/getAllMenuList')
      if (res && res.code === 200) {
        return res
      }
    },

    // 其他全局-获取全部角色列表
    async getAllRoleManagement({ commit }, params) {
      let res = await post('/api/crm/sys/manage/crm/role/getRoleAllList')
      if (res && res.code === 200) {
        return res
      }
    },

    // 其他全局-获取角色用户级联数据
    async getRoleCascadeRelation({ commit }, params) {
      let res = await post('/api/crm/sys/manage/crm/role/getRoleCascadeRelation', params || {})
      if (res && res.code === 200) {
        return res.data
      }
    },

    // 其他全局-获取公司用户级联数据
    async getUserCascadeRelation({ commit }, params) {
      let res = await post('/api/crm/sys/manage/crm/user/getUserCascadeRelation', params || {})
      if (res && res.code === 200) {
        return res.data
      }
    },

    // 其他全局-获取公司列表
    async getCompanyList({ commit }, params) {
      let res = await post('/api/cms/sysuser/auth/0.2/company/list', params || {})
      if (res && res.code === 200) {
        return res
      }
    },

    // 首页-获取统计总数
    async getStatisticalTotal({ commit }, params) {
      let res = await post('/api/crm/sys/manage/demand/statisticalTotal', params || {})
      if (res && res.code === 200) {
        return res
      }
    },

    // 首页-获取统计总览数据-需求列表
    async getStatisticalOverviewData({ commit }, params) {
      let res = await post('/api/crm/sys/manage/demand/statisticalOverviewData', params || {})
      if (res && res.code === 200) {
        return res
      }
    },

    // 首页-获取统计总览数据-内置列表
    async getStatisticalBuiltInData({ commit }, params) {
      let res = await post('/api/crm/sys/manage/builtIn/management/statisticalBuiltInData', params || {})
      if (res && res.code === 200) {
        return res
      }
    },

    // 首页-获取统计日期数据
    async getStatisticalDateData({ commit }, params) {
      let res = await post('/api/crm/sys/manage/demand/statisticalDateData', params || {})
      if (res && res.code === 200) {
        return res
      }
    },

    // 首页-获取统计配置数据
    async getStatisticalConfigurationData({ commit }, params) {
      let res = await post('/api/crm/sys/manage/demand/statisticalConfigurationData', params || {})
      if (res && res.code === 200) {
        return res
      }
    },

    // 用户权限管理-获取用户详情
    async getUserInfo({ commit }, params) {
      let res = await post('/api/crm/sys/manage/crm/user/getUserInfoById', params || {})
      if (res && res.code === 200) {
        return res
      }
    },

    // 用户权限管理-用户列表
    async getUserManagement({ commit }, params) {
      let res = await post('/api/crm/sys/manage/crm/user/list', params || {})
      if (res && res.code === 200) {
        return res
      }
    },

    // 用户权限管理-获取角色详情
    async getRoleInfo({ commit }, params) {
      let res = await post('/api/crm/sys/manage/crm/role/getRoleInfo', params || {})
      if (res && res.code === 200) {
        return res
      }
    },

    // 用户权限管理-角色列表
    async getRoleManagement({ commit }, params) {
      let res = await post('/api/crm/sys/manage/crm/role/list', params || {})
      if (res && res.code === 200) {
        return res
      }
    },

    // 客户管理-列表
    async getCustomerManagement({ commit }, params) {
      let res = await post('/api/crm/sys/manage/customer/info/queryList', params || {})
      if (res && res.code === 200) {
        return res
      }
    },

    // 需求管理-查询统计
    async getDemandStatistics({ commit }, params) {
      let res = await post('/api/crm/sys/manage/demand/queryStatistics', params || {})
      if (res && res.code === 200) {
        return res
      }
    },

    // 需求管理-需求列表
    async getDemandList({ commit }, params) {
      let res = await post('/api/crm/sys/manage/demand/queryList', params || {})
      if (res && res.code === 200) {
        return res
      }
    },

    // 公司公告-通知公告表
    async getNoticeList({ commit }, params) {
      let res = await post('/api/crm/sys/manage/notice/queryList', params || {})
      if (res && res.code === 200) {
        return res
      }
    },

    // 公司公告-公告栏配置表
    async getNoticeColumnList({ commit }, params) {
      let res = await post('/api/crm/sys/manage/notice/queryColumnList', params || {})
      if (res && res.code === 200) {
        return res
      }
    },

    // 物料管理-获取导入列表
    async getBuiltInImportList({ commit }, params) {
      let res = await post('/api/crm/sys/manage/builtIn/management/queryImportList', params || {})
      if (res && res.code === 200) {
        return res
      }
    },

    // 物料管理-内置管理
    async getBuiltInManagement({ commit }, params) {
      let res = await post('/api/crm/sys/manage/builtIn/management/queryList', params || {})
      if (res && res.code === 200) {
        return res
      }
    },

    // 物料管理-基础配置
    async getMaterielBasicConfiguration({ commit }, params) {
      let res = await post('/api/crm/sys/manage/material/configuration/queryList', params || {})
      if (res && res.code === 200) {
        return res
      }
    },

    // App相关管理-App功能配置
    async getAppFunctionsList({ commit }, params) {
      let res = await post('/api/cms/sysuser/auth/systemApp/appFunctions/queryList', params || {})
      if (res && res.code === 200) {
        commit('getAppFunctionsList', res)
        return res.data
      }
    },

    // 壁纸管理-Tag
    async getWallpaperTagList({ commit }, params) {
      let res = await post('/api/cms/sysuser/auth/wallpaper/tag/getTagList', params || {})
      if (res && res.code === 200) {
        commit('getWallpaperTagList', res)
        return res.data
      }
    },

    // 壁纸管理-关键字
    async getWallpaperKeyWordsList({ commit }, params) {
      let res = await post('/api/cms/sysuser/auth/wallpaper/keywords/getKeywordsList', params || {})
      if (res && res.code === 200) {
        commit('getWallpaperKeyWordsList', res)
        return res.data
      }
    },

    // 壁纸管理-合集
    async getWallpaperCollectionList({ commit }, params) {
      let res = await post('/api/cms/sysuser/auth/wallpaper/collection/queryCollectionList', params || {})
      if (res && res.code === 200) {
        commit('getWallpaperCollectionList', res)
        return res.data
      }
    },

    // 金刚区
    async getDialDiamondDistrictList({ commit }, params) {
      let res = await post('/api/cms/sysuser/auth/dialMarket/kongDistrict/queryKongDistrictList', params || {})
      if (res && res.code === 200) {
        commit('getDialDiamondDistrictList', res)
        return res.data
      }
    },

    // 表盘关键字
    async getDialKeyWordsList({ commit }, params) {
      let res = await post('/api/cms/sysuser/auth/dialKeywords/getDialKeywordsList', params || {})
      if (res && res.code === 200) {
        commit('getDialKeyWordsList', res)
        return res.data
      }
    },

    // 表盘tag
    async getDialSmallTagList({ commit }, params) {
      let res = await post('/api/cms/sysuser/auth/tagManagement/getDialMarketTagList', params || {})
      if (res && res.code === 200) {
        commit('getDialSmallTagList', res)
        return res.data
      }
    },

    // 获取世界城市列表
    async getWorldCityList({ commit }, params) {
      let req = await post('/api/cms/sysuser/auth/world/city/queryCityList', params || {})
      commit('getWorldCityList', req)
      return req.data
    },

    // 中国省/市级联关系列表
    async getChinaCascadeRelation ({ commit }, params) {
      let req = await get(`/api/cms/sysuser/auth/world/city/getChinaCascadeRelation`)
      if (req.data.code === 200) {
        commit('getChinaCascadeRelation', req.data)
        return req.data.data
      }
    },

    // 设备版本配置信息列表
    async getDeviceVersionList({ commit }, params) {
      let req = await post('/web/cms/dial/0.2/dev/getDeviceVersion', params || {})
      commit('getDeviceVersionList', req)
      return req.data
    },

    // 表盘信息
    async getAppRenewChannelList({ commit }, params) {
      let req = await post('/api/cms/sysuser/auth/systemApp/queryRenewChannelList', params || {})
      commit('getAppRenewChannelList', req)
      return req.data
    },
    // 表盘信息
    async getAppRenewList({ commit }, params) {
      let req = await post('/api/cms/sysuser/auth/systemApp/queryRenewList', params || {})
      commit('getAppRenewList', req)
      return req.data
    },
    // 表盘信息
    async getDialListData({ commit }, params) {
      let req = await post('/web/cms/dial/0.2/dial/mgr/list', params || {})
      commit('getDialListData', req.data)
      return req.data
    },
    // app信息列表
    async getAppInfoList({ commit }, params) {
      let req = await post('/api/cms/sysuser/auth/systemApp/information/getAppInfoList', params || {})
      commit('getAppInfoList', req.data)
      return req.data
    },

    // app名字map
    async getAppNameMap({ commit }, params) {
      let req = await post('/api/cms/sysuser/auth/systemApp/information/getAppScreeningCondition')
      commit('getAppNameMap', req.data)
      return new Map(Object.entries(req.data))
    },

    // 字典项列表
    async getSysDictItemList ({ commit }, params) {
      let req = await get(`/api/cms/sysuser/auth/dict/type/${params}`)
      if (req.data.code === 0) {
        commit('getSysDictItemList', req.data.data)
        return req.data.data
      }
    },
    // 主控型号级联关系
    async getIcMcodeCascadeRelation ({ commit }) {
      let req = await get(`/api/cms/sysuser/auth/dict/getIcMcodeCascadeRelation`)
      if (req.data.code === 200) {
        commit('getIcMcodeCascadeRelation', req.data.data)
        return req.data.data
      }
    },
    app () {}
  },
  getters: {

  }
}
export default module1
